

#ifndef __SPRITEBATCHBMFONT__
#define __SPRITEBATCHBMFONT__

#include <QString>
#include "SpriteBatch.h"
#include "xmle.h"

class SpriteBatchBMFont {
public:
    SpriteBatchBMFont( QString descFileName,
                       QString fontImageName );

    ~SpriteBatchBMFont();

    void writeText( SpriteBatch *sb, const char *string, float x, float y, float size,
                    float angle=0.0f,
                    float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f );
    float getTextLength( const char *string, float size );

protected:
    static void letterFoundCallBack( TXML::Node *node, void *datato );

    float m_sourceWScale;
    float m_sourceHScale;
    float m_mainSize;
    struct LetterInfo {
        float sx,sy,swidth,sheight;
        float xsize, ysize;
        float xoffset, yoffset;

        float xadvance;
    };

    LetterInfo asciiLetters[256];

    unsigned int m_fontTexture;
};


#endif
